/*
 * (PARI) R. J. Cano, Mar 29 2014
 * 
 * This is mainly a sourcecode-level (or definition-level) exposition:
 * 
 * Note: For those readers not familiar/experienced with PARI-GP,
 * sample outputs are included below.
 * 
 * Since imho the syntax for definition is quite intuitive,
 * I used few language dependent constructions. Almost all
 * looks like C code.
 *
 * A tilde suffix or "~" means matrix transposition. So W~ means tr(W)
 * or W transposed. To transpose a vector switches it between row or column.
 * 
 * The omnipresent object "matrix(r,r,i,j,i>j)" is the r*r strictly lower
 * triangular matrix (made just with 1 and zero) known in linear algebra
 * and group theory.
 * 
 * I hope that the following exposition can be found enough clear and
 * intuitive, in order to appreciate and enjoy all the comments about
 * observed properties,the same that I am glad to share with the
 * reader.
 * 
 * The script ends with additional comments and personal thoughts
 * from the author, and if this script were loaded with the PARI-GP
 * interpreter, it just silently loads all the definitions giving
 * chance to the user for playing around with them....
 * 
 * ...Or for building something more that the author currently ignores.
 * 
 * Cheers!.
 * 
 */

/*
 * 
 * The following exploration begun as a simplification exercise for A215940 and
 * the related sequences, in terms of the current way of calculation for its terms
 * (base independent, using linear algebra).
 * 
 * For more details and definitive motivation, please see the comments and links at
 * A215940, A217626, A211869, their cf...
 * 
 * In the further, the reader will find some definitions, and informally phrased
 * comments about the particular interpretation from the author on each defined
 * object.
 * 
 */

a(r)=matrix(r,r,i,j,i>j)*vectorv(r,j,r-2*j); /* A211869 alike palindromes */

/*
 * f(r) is based on the following theorem: For non-negative integers  m, n, the power p(m,n)= m^n is:
 * 
 * ( "!n" below means "not n" instead of some factorial-based function.
 *   It fixes the zero exponent answer agreed to be 1 by default )
 * 
*/

p(m,n)=!n+sum(q=1,n,q!*stirling(n,q,2)*binomial(m,q));

/* Taking advantage of such result we define f(r) as: */

f(r)=matrix(r,r,i,j,i>j)*vectorv(r,j,sum(q=1,r-j,(q!)*stirling(r-j,q,2)*(binomial(r-j,q)-binomial(j,q))));

/* g(r) is the actual calculation intended to be alternatively solved by f(r) */

g(r)=matrix(r,r,i,j,i>j)*vectorv(r,j,(r-j)^(r-j)-(j)^(r-j));

/*
 * t0 is a transformation which subtract the components from up to down in a column vector.
 */

t0(w,k=1)=if(k+1==#w,vectorv(#w,j,(j>k)*(w[j]-w[k])), t0(vectorv(#w,j,(j>k)*(w[j]-w[k])),k+1));

/*
 * t1: We might choose not to filter anything in t0 (eventually getting only a number),
 *     but keep the whole outcome instead by deleting each factor "(j>k)*" inside a
 *     clone definition.
 */

t1(w,k=1)=if(k+1==#w,vectorv(#w,j,(w[j]-w[k])), t1(vectorv(#w,j,(w[j]-w[k])),k+1));

/*
 * 
 *  It is noteworthy that both t0 and t1 are recursive definitions.
 * 
 *  PARI-GP uses the "if" selector in this way: "if(condition, dothis, elsedothisother);"
 * 
 */

/*
 
 Sample output I: Behavior for a(r), then -t0 and -t1 applied to a(r)
? r=2;
? a(r++)
%22 = [0, 1, 0]~
? a(r++)
%23 = [0, 2, 2, 0]~
? a(r++)
%24 = [0, 3, 4, 3, 0]~
? a(r++)
%25 = [0, 4, 6, 6, 4, 0]~
? a(r++)
%26 = [0, 5, 8, 9, 8, 5, 0]~
? a(r++)
%27 = [0, 6, 10, 12, 12, 10, 6, 0]~
? r
%28 = 8
? r=2;
? -t0(a(r++))
%30 = [0, 0, 1]~
? -t0(a(r++))
%31 = [0, 0, 0, 2]~
? -t0(a(r++))
%32 = [0, 0, 0, 0, 3]~
? -t0(a(r++))
%33 = [0, 0, 0, 0, 0, 4]~
? -t0(a(r++))
%34 = [0, 0, 0, 0, 0, 0, 5]~
? -t0(a(r++))
%35 = [0, 0, 0, 0, 0, 0, 0, 6]~
? r
%36 = 8
? r=2;
? -t1(a(r++))
%38 = [1, 0, 1]~
? -t1(a(r++))
%39 = [2, 0, 0, 2]~
? -t1(a(r++))
%40 = [3, 0, -1, 0, 3]~
? -t1(a(r++))
%41 = [4, 0, -2, -2, 0, 4]~
? -t1(a(r++))
%42 = [5, 0, -3, -4, -3, 0, 5]~
? -t1(a(r++))
%43 = [6, 0, -4, -6, -6, -4, 0, 6]~
? -t1(a(r++))
%44 = [7, 0, -5, -8, -9, -8, -5, 0, 7]~
? -t1(a(r++))
%45 = [8, 0, -6, -10, -12, -12, -10, -6, 0, 8]~
? -t1(a(r++))
%46 = [9, 0, -7, -12, -15, -16, -15, -12, -7, 0, 9]~
? -t1(a(r++))
%47 = [10, 0, -8, -14, -18, -20, -20, -18, -14, -8, 0, 10]~
? -t1(a(r++))
%48 = [11, 0, -9, -16, -21, -24, -25, -24, -21, -16, -9, 0, 11]~
? 

A curious property is revealed:

? -a(6)
%59 = [0, -4, -6, -6, -4, 0]~
? -t1(a(8))
%60 = [6, 0, -4, -6, -6, -4, 0, 6]~

-t1(a(r+2)) is identical to [r,-a(r)~,r]~ ...in the sense of what a human reader would replace instead.

This is, if you enter it as is directly to PARI, you will get:

? r=4;
? -t1(a(r+2))
%2 = [4, 0, -2, -2, 0, 4]~
? [r,-a(r)~,r]~
%3 = [4, [0, -2, -2, 0], 4]~

And of course, evidently [4, 0, -2, -2, 0, 4]~

IS NOT (conceptually) the same than [4, [0, -2, -2, 0], 4]~

But then the reader would catch that what I did mean is to delete the inner pair [].

-----

Isn't it nice after all?: The palindrome symmetry is conserved!!!.

.
.
.

 Sample output II: Behavior for -t0 applied to f(r) and g(r)
 
? 
? r=2;
? -t0(f(r++))
%43 = [0, 0, 1]~
? -t0(f(r++))
%44 = [0, 0, 0, 2]~
? -t0(f(r++))
%45 = [0, 0, 0, 0, 3]~
? -t0(f(r++))
%46 = [0, 0, 0, 0, 0, 4]~
? -t0(f(r++))
%47 = [0, 0, 0, 0, 0, 0, 5]~
? -t0(f(r++))
%48 = [0, 0, 0, 0, 0, 0, 0, 6]~
? s=2;
? -t0(g(s++))
%50 = [0, 0, 1]~
? -t0(g(s++))
%51 = [0, 0, 0, 2]~
? -t0(g(s++))
%52 = [0, 0, 0, 0, 3]~
? -t0(g(s++))
%53 = [0, 0, 0, 0, 0, 4]~
? -t0(g(s++))
%54 = [0, 0, 0, 0, 0, 0, 5]~
? -t0(g(s++))
%55 = [0, 0, 0, 0, 0, 0, 0, 6]~
? r
%56 = 8
? s
%57 = 8
? 

 Sample output III: Behavior for -t1 applied to f(r) and g(r)
 
? r=2;
? -t1(f(r++))
%2 = [3, 0, 1]~
? -t1(f(r++))
%3 = [26, 0, 0, 2]~
? -t1(f(r++))
%4 = [269, 14, -5, 0, 3]~
? -t1(f(r++))
%5 = [3352, 228, -12, -12, 0, 4]~
? -t1(f(r++))
%6 = [49865, 3210, 117, -58, -21, 0, 5]~
? -t1(f(r++))
%7 = [872886, 49344, 2752, -130, -130, -32, 0, 6]~
? -t1(f(r++))
%8 = [17648055, 870840, 47425, 1498, -603, -234, -45, 0, 7]~
? -t1(f(r++))
%9 = [405059948, 17639460, 862500, 41144, -1416, -1416, -376, -60, 0, 8]~
? r
%10 = 10
? s=2;
? -t1(g(s++))
%12 = [3, 0, 1]~
? -t1(g(s++))
%13 = [26, 0, 0, 2]~
? -t1(g(s++))
%14 = [269, 14, -5, 0, 3]~
? -t1(g(s++))
%15 = [3352, 228, -12, -12, 0, 4]~
? -t1(g(s++))
%16 = [49865, 3210, 117, -58, -21, 0, 5]~
? -t1(g(s++))
%17 = [872886, 49344, 2752, -130, -130, -32, 0, 6]~
? -t1(g(s++))
%18 = [17648055, 870840, 47425, 1498, -603, -234, -45, 0, 7]~
? -t1(g(s++))
%19 = [405059948, 17639460, 862500, 41144, -1416, -1416, -376, -60, 0, 8]~
? s
%20 = 10
?

Some final personal comments for now:

Sure, since f(r)==g(r), to repeat both t0 and t1 for each one is a little bit fool.

The thing is that I didn't gave you a proof about m^n=p(n,m) by only stating the
theorem. Then it is not actually unnecessary.

----------------------Splitting apart-------------------------

Also a matter of improvisation and exploration, we might look this expression: (binomial(r-j,q)-binomial(j,q))

As if it were and (r-1)*(r-1) matrix and (j,q) the multi-index for its components. So:

unknown(r)=matrix(r-1,r-1,j,q,binomial(r-j,q)-binomial(j,q));

*/

unknown0(r)=matrix(r-1,r-1,j,q,binomial(r-j,q)-binomial(j,q));

/* Again, just by curiosity: */

unknown1(r)=matrix(r-1,r-1,i,j,i>j)*matrix(r-1,r-1,j,q,binomial(r-j,q)-binomial(j,q));

/* And also: */

unknown2(r)=matrix(r-1,r-1,i,j,i>j)*(matrix(r-1,r-1,j,q,binomial(r-j,q)-binomial(j,q))~);

/* Please don't ask me "why?" about the (r-1) in the size. Just please see the reason yourself by replacing (r-1) with r */

/*

? unknown0(1)
[;]

? unknown0(2)

[0]

? unknown0(3)

[1 1]

[-1 -1]

? unknown0(4)

[2 3 1]

[0 0 0]

[-2 -3 -1]

? unknown0(5)

[3 6 4 1]

[1 2 1 0]

[-1 -2 -1 0]

[-3 -6 -4 -1]

? unknown0(6)

[4 10 10 5 1]

[2 5 4 1 0]

[0 0 0 0 0]

[-2 -5 -4 -1 0]

[-4 -10 -10 -5 -1]

? unknown1(1)
[;]
? unknown1(2)

[0]

? unknown1(3)

[0 0]

[1 1]

? unknown1(4)

[0 0 0]

[2 3 1]

[2 3 1]

? unknown1(5)

[0 0 0 0]

[3 6 4 1]

[4 8 5 1]

[3 6 4 1]

? unknown1(6)

[0 0 0 0 0]

[4 10 10 5 1]

[6 15 14 6 1]

[6 15 14 6 1]

[4 10 10 5 1]

? unknown1(7)

[0 0 0 0 0 0]

[5 15 20 15 6 1]

[8 24 30 20 7 1]

[9 27 33 21 7 1]

[8 24 30 20 7 1]

[5 15 20 15 6 1]

? unknown2(1)
[;]
? unknown2(2)

[0]

? unknown2(3)

[0 0]

[1 -1]

? unknown2(4)

[0 0 0]

[2 0 -2]

[5 0 -5]

? unknown2(5)

[0 0 0 0]

[3 1 -1 -3]

[9 3 -3 -9]

[13 4 -4 -13]

? unknown2(6)

[0 0 0 0 0]

[4 2 0 -2 -4]

[14 7 0 -7 -14]

[24 11 0 -11 -24]

[29 12 0 -12 -29]

? unknown2(7)

[0 0 0 0 0 0]

[5 3 1 -1 -3 -5]

[20 12 4 -4 -12 -20]

[40 22 7 -7 -22 -40]

[55 27 8 -8 -27 -55]

[61 28 8 -8 -28 -61]

 *
 *
 * Well, right now I don't have nothing more to tell, beyond the
 * simple observation of the nice symmetry present in such objects.
 *
 * (It is curious the fact that symmetry looks nice for the human and would look desirable for the
 *  machines. "desirable for a machine?", might reply the reader. But yes, an hypothetical machine
 *  capable with self-conscience/sensible AI, would find any symmetry as a highly appreciated feature
 *  in all what it must deal with, since the symmetry in principle, allows to save storage and processing).
 *
 * Nothing moreto say...
 * Do I am sure?... Hmmm!, wait, of course, indeed I can take advantage of this work for emphasizing
 * the important logical connection already existing between the elementary concepts in enumerative
 * combinatorics like the so called "permutations" or "combinations without repetitions", and the
 * "integer-radix-based" number systems like the binary, decimal, and hexadecimal.
 * 
 * What surf in the thinking is: Instead of talking about the permutations for the first N naturals (1,2,3,....,N),
 * 
 * Why not?... to talk about the "natural permutations" for base N.
 *
 * Since in fact, the set for smaller-valued numerals necessary in order to represent permutations match the digits of
 * certain base. I believe that I am talking here informally (empirically) about what computer scientist call "letters".
 * 
 * For example, work for A215940, A217626, A211869, the "A. R. Povolotsky's pairs" sequences and another fields of application
 * can be treated in a suitable way by using the non negative integers instead of natural numbers, I mean 0..(N-1) instead of
 * 1..N; being the unique trivial and possible flaw the fact that the zero cannot be used as divisor.
 * 
 * At purpose: Should this distress us?. ...No!, since the (r-1) theorem about divisibility requires at least r=2;
 * 
 * (You need at least two different symbols (namely 0 and 1) to write numbers).
 * 
 * I won't fight against well stated and proved-to-work definitions or conventions already in use as well known fail-safe
 * standards, but it is nice always from time to time, to observe common properties and similarities, and propose possible
 * unification and simplification, in the spirit of keeping the things the more simple possible, but no more.
 * 
 * In some distant or close place out there in the Universe, a human-like civilization highly obsessed with the databases
 * might have a scheme of classification for chemical compounds based only in Carbon(2), Hydrogen(0), and Oxygen(1), dividing
 * these compounds in big families according the rank of relative concentrations of these elements.
 * 
 * The identify such possible families we might think aloud like in the following way:
 * 
 * 0 _ 1 ; 2
 * 0 _ 2 ; 1
 * 1 _ 0 ; 2
 * 1 _ 2 ; 0
 * 2 _ 0 ; 1
 * 2 _ 1 ; 0
 * 
 * Where underscore and semicolon are wildcards to be replaced with an arithmetical relational operator.
 * 
 * (We might add and extra wildcard atomic specie "E" meaning "othErs elements", but then the
 *  incomplete list above jumps from 6 to 24 rows!!, imho a waste in terms of motivation)
 * 
 * Our E.T. friends might have interested on keeping in such sort of database all the mathematical possibilities,
 * in order to offer explanations for their young students and apprentices about the chemical properties that
 * make impossible the existence of certain compounds (instability, Hund's rule violations, and so on).
 * 
 * Then a young apprentice might query such database in order to shed light on his own mistakes, or learning more
 * about the structure of the atom, quantum mechanics... and where the mathematics must stop to give full control
 * to physical models and proposed laws.
 * 
 * I am not enough familiar to Organic Chemistry in order to fulfill the described task in a realistic way.
 * 
 * ...for now.
 * 
 * In the same sense that Chemistry people don't use to talk deeply about the Schrodinger's equation or the Hartree theory
 * there in the daily Lab, some day one of them might ask himself/herself why some combinations of atoms never occur in
 * the nature, and the mentioned (all-possible-stuff-regardless-the-absurd-of-it) database would be available and appreciated.
 * 
 * ... Also for a review on the essentials.
 * ......Specially for those who share their time between the research and lessons given at the University.
 * 
 * In such sense, a Mathematician would like to explore how much of his/her mathematical solution for this problem becomes
 * useful in the real world (lab) of the chemistry.
 * 
 * I don't fear here to be taken as a whole fool. I ignore if my hero Carl Sagan did think on this before, or if original
 * and smart people already took this question seriously long time ago (perhaps some friend or counterpart of Hilbert in
 * similar way to Caratheodory and his unfortunate and apparently forgotten axiomatizing on the Thermodynamics).
 * 
 * (EOF) */